home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 3 of 3 / CHAPTE10 / OPEN / LINE.C < prev    next >
C/C++ Source or Header  |  1996-04-28  |  20KB  |  643 lines

  1.  
  2. #include <windows.h> 
  3. #include <windowsx.h> 
  4. #include "line.h" 
  5. #include "tapi.h"
  6.  
  7. #define BUFSIZE 256
  8. #define APIHIVERSION     0x00010028    /* 1.40 */
  9. #define APILOWVERSION    0x00010000    /* 1.0 */
  10. #define EXTHIVERSION     0x00010005    /* 1.5 */
  11. #define EXTLOWVERSION    0x00000009    /* 0.9 */ 
  12. #define OWNER        0
  13. #define MONITOR      1
  14. #define MAX_CALL        3
  15. #define MAX_LINE        2
  16.  
  17.  
  18. #if defined (WIN32)
  19.     #define IS_WIN32 TRUE
  20. #else
  21.     #define IS_WIN32 FALSE
  22. #endif
  23.  
  24. #define IS_NT      IS_WIN32 && (BOOL)(GetVersion() < 0x80000000)
  25. #define IS_WIN32S  IS_WIN32 && (BOOL)(!(IS_NT) && (LOBYTE(LOWORD(GetVersion()))<4))
  26. #define IS_WIN95   (BOOL)(!(IS_NT) && !(IS_WIN32S)) && IS_WIN32
  27.  
  28. LPCTSTR lpszAppName = "lineOpen";
  29. LPCTSTR lpszTitle   = "lineOpen"; 
  30.  
  31. HINSTANCE hInst;   // current instance
  32. HWND hWnd;         // parent window handle
  33. HWND hListWnd;     // listbox
  34. HDC  hdc;
  35. TEXTMETRIC  tm ;
  36.  
  37. BOOL RegisterWin95( CONST WNDCLASS* lpwc );
  38.  
  39.  
  40. int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
  41.                       LPTSTR lpCmdLine, int nCmdShow)
  42. {
  43.    MSG      msg;
  44.    WNDCLASS wc;
  45.  
  46.    wc.style         = CS_HREDRAW | CS_VREDRAW;
  47.    wc.lpfnWndProc   = (WNDPROC)WndProc;       
  48.    wc.cbClsExtra    = 0;                      
  49.    wc.cbWndExtra    = 0;                      
  50.    wc.hInstance     = hInstance;              
  51.    wc.hIcon         = LoadIcon (hInstance, lpszAppName); 
  52.    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  53.    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  54.    wc.lpszMenuName  = lpszAppName;              
  55.    wc.lpszClassName = lpszAppName;              
  56.  
  57.    if ( IS_WIN95 )
  58.    {
  59.       if ( !RegisterWin95( &wc ) )
  60.          return( FALSE );
  61.    }
  62.    else if ( !RegisterClass( &wc ) )
  63.       return( FALSE );
  64.  
  65.    hInst = hInstance; 
  66.  
  67.    hWnd = CreateWindow( lpszAppName, 
  68.                         lpszTitle,    
  69.                         WS_OVERLAPPEDWINDOW, 
  70.                         CW_USEDEFAULT, 0, 
  71.                         CW_USEDEFAULT, 0,  
  72.                         NULL,              
  73.                         NULL,              
  74.                         hInstance,         
  75.                         NULL               
  76.                       );
  77.  
  78.    if ( !hWnd ) 
  79.       return( FALSE );
  80.  
  81.    ShowWindow( hWnd, nCmdShow ); 
  82.    UpdateWindow( hWnd );         
  83.  
  84.    while( GetMessage( &msg, NULL, 0, 0) )   
  85.    {
  86.       TranslateMessage( &msg ); 
  87.       DispatchMessage( &msg );  
  88.    }
  89.  
  90.    return( msg.wParam ); 
  91. }
  92.  
  93.  
  94. BOOL RegisterWin95( CONST WNDCLASS* lpwc )
  95. {
  96.     WNDCLASSEX wcex;
  97.  
  98.    wcex.style         = lpwc->style;
  99.    wcex.lpfnWndProc   = lpwc->lpfnWndProc;
  100.    wcex.cbClsExtra    = lpwc->cbClsExtra;
  101.    wcex.cbWndExtra    = lpwc->cbWndExtra;
  102.    wcex.hInstance     = lpwc->hInstance;
  103.    wcex.hIcon         = lpwc->hIcon;
  104.    wcex.hCursor       = lpwc->hCursor;
  105.    wcex.hbrBackground = lpwc->hbrBackground;
  106.    wcex.lpszMenuName  = lpwc->lpszMenuName;
  107.    wcex.lpszClassName = lpwc->lpszClassName;
  108.  
  109.    // Added elements for Windows 95.
  110.    //...............................
  111.    wcex.cbSize = sizeof(WNDCLASSEX);
  112.    wcex.hIconSm = LoadImage(wcex.hInstance, lpwc->lpszClassName, 
  113.                             IMAGE_ICON, 16, 16,
  114.                             LR_DEFAULTCOLOR );
  115.             
  116.    return RegisterClassEx( &wcex );
  117. }
  118.  
  119. #define CONFCALL    1
  120. #define CONSULT      2
  121.  
  122. enum CallState
  123. {
  124.     Idle,
  125.     Offering,
  126.     Accepted,
  127.     Dialtone,
  128.     Dialing,
  129.     Ringback,
  130.     Busy,
  131.     Special,
  132.     Connected,
  133.     Proceeding,
  134.     Conferenced,
  135.     Onholdconf,
  136.     Disconnected,
  137.     Unknown
  138. };
  139.  
  140. typedef struct tagMYINFO      // general application information
  141. {
  142.     HLINEAPP lineApp;         // instance handle TAPI gives back to us                                                                              through lineInitialize()
  143.     DWORD dwNumDevices;       // number of available devices
  144.     DWORD dwAPIVersion;       // API version the line supports
  145.      DWORD dwExtVersion;           // extended version
  146.     char szLocation[128];     // location        
  147.      char szCallingCard[128];  // calling card being used
  148.     char szAreaCode[4];       // area code       
  149.     char szCountry[128];      // calling card being used
  150. } MYINFO;
  151.  
  152. typedef struct tagLINEINFO  // information on an open line
  153. {
  154.     DWORD dwNumAddress;     // number of available addresses on the line 
  155.     HLINE hLine;            // handle to the line as returned by lineOpen 
  156.      DWORD dwLineID;         // the line ID of this line
  157.     char  szLineName[128];  // the line's name 
  158.  
  159. } MYLINEINFO;
  160.  
  161. typedef struct tagMYCALLINFO  //information on a call                     
  162. {
  163.     
  164. DWORD       eCallState;    // TAPI's line call State, set as user-defined enums
  165. DWORD      dwRequestID;   // requestID returned by async TAPI functions lineMakeCall/lineDropCall
  166. DWORD      dwAddressID;   // the originating address ID of the call being made 
  167. LPCSTR     lpszAddress;    
  168. HLINE     hLine;         // handle to the line 
  169. HCALL        hCall;         // handle to the call 
  170.    
  171. char szDialString[TAPIMAXDESTADDRESSSIZE];  //phone number being dialed
  172. char szDialStringOriginal[TAPIMAXDESTADDRESSSIZE];
  173. char szDialStringCanonical[TAPIMAXDESTADDRESSSIZE];
  174. char szCalledParty[TAPIMAXCALLEDPARTYSIZE]; // name of the party
  175. DWORD dwTranslateResults;
  176.         
  177. } MYCALLINFO;
  178.  
  179. enum CallAction     // Declare enum type CallAction (used in lineSetAppSpecific)
  180. {
  181.    HOLD,            // hold the call
  182.    TRANSFER,        // transfer the call
  183.    REDIRECT,        // redirect the call
  184.    DROP,            // drop the call
  185.    PARK             // park the call
  186. }; 
  187.  
  188. MYINFO myInfo;          //instance of MYINFO structure
  189. MYLINEINFO myLineInfo[MAX_LINE];  //instance of MYLINEINFO structure
  190. MYCALLINFO myCallInfo[MAX_CALL]; //array of MYCALLINFO strcuture
  191.  
  192. LONG lRet;        //return code
  193. char buf[BUFSIZE];    // buffer for debug message
  194.  
  195. DWORD dwLineID = 0;
  196. DWORD i;
  197. LINEEXTENSIONID        ext_id;
  198. LINEDEVCAPS            *plineDevCaps;
  199. LINEADDRESSCAPS        *plineAdddressCaps;
  200. LINEADDRESSSTATUS     *plineAddressStat;
  201. LINECALLINFO            *plineCallInfo;
  202. LINECALLSTATUS         *plineCallStatus;
  203. LINECALLLIST            *plineCallList;
  204. LINEDEVSTATUS           *plineDevStatus;
  205. LINETRANSLATECAPS       *plineTranslateCaps;
  206. LINETRANSLATEOUTPUT  *plineTranslateOutput;
  207. LINECALLPARAMS           *plineCallParams;
  208. LINEDEVSTATUS           *plineDevStatus;
  209. LINEFORWARDLIST        *plineForwardList;
  210. LINETRANSLATECAPS       *plineTranslateCaps;
  211. LINEREQMAKECALL       lineReqMakeCall;
  212. VARSTRING               *pDeviceConfig;
  213. VARSTRING               *pDeviceId;
  214. VARSTRING               *pNonDirAddress;
  215.  
  216. LPLINELOCATIONENTRY  lineLocEntry;
  217. LPLINECARDENTRY        lineCardEntry;
  218. LINECOUNTRYLIST         *plineCountryList;
  219. LPLINECOUNTRYENTRY   lineCE;
  220.  
  221. LPSTR                lpData;
  222.  
  223. HICON                hIcon = NULL;        //used in lineGetID();
  224. DWORD                dwNumRings;    //used in lineGetNumRings();
  225. HCALL                hConsultCall; //handle to consultation linePrepareAddToConference, SetupConference
  226. HCALL                hConfCall; //handle to consultation linePrepareAddToConference, SetupConference   
  227. HCALL                hParkedCall;
  228.  
  229. DWORD                dwCompletionID;  //used in lineCompleteCall()
  230.  
  231. char                szName[128];
  232. char                szNumber[128];
  233. char                szDigits[128];
  234. char                szDevConfig[128];
  235.  
  236. LONG lRet;
  237. char buf[BUFSIZE];
  238.  
  239. LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  240. {
  241.    switch( uMsg )
  242.    {
  243.       case WM_COMMAND :
  244.          switch( LOWORD( wParam ) )
  245.          {
  246.             case IDM_RUN :
  247.                //lineOpen
  248.                 //................................................................
  249.                 lRet = lineOpen(myInfo.lineApp,myLineInfo[OWNER].dwLineID,&myLineInfo[OWNER].hLine,
  250.                                  myInfo.dwAPIVersion,0,(DWORD)lineCallback, LINECALLPRIVILEGE_NONE,
  251.                                   LINEMEDIAMODE_DATAMODEM, NULL);
  252.                 if (lRet == 0)
  253.                 {
  254.                   wsprintf (buf, "lineOpen suceeded!");
  255.                   SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;         }
  256.                  else 
  257.                  {
  258.                      wsprintf ( buf,"lineOpen failed, err=x%lx", lRet);
  259.                      SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  260.                      lineError(lRet);
  261.                 }
  262.        
  263.                break;                      
  264.             
  265.             case IDM_ABOUT :
  266.             {
  267.                 DialogBox( hInst, "AboutBox", hWnd, (DLGPROC)About );
  268.                break;
  269.             }
  270.  
  271.             case IDM_EXIT :
  272.             {
  273.                for (i = 0; i < myInfo.dwNumDevices; i++)
  274.                        lineClose(myLineInfo[i].hLine);
  275.                     lineShutdown(myInfo.lineApp);
  276.                DestroyWindow( hWnd );
  277.                break;
  278.             }
  279.             }                  
  280.                  
  281.          break;
  282.  
  283.       case WM_CREATE :
  284.       {
  285.          hdc = GetDC (hWnd) ;
  286.          GetTextMetrics (hdc, &tm) ;
  287.          ReleaseDC (hWnd, hdc) ;
  288.  
  289.          hListWnd = CreateWindowEx( 0, "listbox", 
  290.                         " ",    
  291.                         WS_CHILD | WS_VISIBLE,  
  292.                         tm.tmAveCharWidth, tm.tmHeight * 3, 
  293.                         tm.tmAveCharWidth * 16 +
  294.                                    GetSystemMetrics (SM_CXVSCROLL), 
  295.                         tm.tmHeight * 5,  
  296.                         hWnd,              
  297.                         NULL,              
  298.                         hInst,         
  299.                         NULL               
  300.                         );
  301.  
  302.          
  303.          //lineInitialize
  304.             //...............................................
  305.          lRet = lineInitialize(&myInfo.lineApp, hInst, lineCallback, NULL, &myInfo.dwNumDevices);
  306.          if (lRet == 0) 
  307.          {
  308.             wsprintf (buf, "lineInitialize suceeded!");
  309.               SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  310.            }
  311.          else 
  312.           {
  313.                wsprintf ( buf,"lineInitialize failed, err=x%lx",lRet);
  314.                SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  315.                lineError(lRet);
  316.                break;
  317.          }                    
  318.          
  319.          //lineNegotiateAPIVersion
  320.           //...............................................
  321.          lRet = lineNegotiateAPIVersion(myInfo.lineApp, 0, APILOWVERSION, APIHIVERSION, 
  322.                                            &myInfo.dwAPIVersion, &ext_id);
  323.          if (lRet == 0)                        
  324.          {
  325.             wsprintf (buf, "lineNegotiateAPIVersion suceeded!");
  326.               SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  327.          }
  328.          else 
  329.           {
  330.                wsprintf (buf, "lineNegotiateAPIVersion failed, err=x%lx",
  331.                            lRet);
  332.                SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  333.                lineError(lRet);
  334.                lineShutdown (myInfo.lineApp);
  335.             break;
  336.          }
  337.  
  338.           //lineNegotiateExtVersion
  339.           //...............................................
  340.          lRet = lineNegotiateExtVersion(myInfo.lineApp, 0, myInfo.dwAPIVersion, EXTLOWVERSION, 
  341.                                            EXTHIVERSION, &myInfo.dwExtVersion);
  342.          if (lRet == 0)                        
  343.          {
  344.             wsprintf (buf, "lineNegotiateExtVersion suceeded!");
  345.             SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  346.  
  347.          }
  348.           else 
  349.           {
  350.                wsprintf (buf, "lineNegotiateExtVersion failed, err=x%lx",
  351.                      lRet);
  352.               SendMessage(hListWnd, LB_INSERTSTRING, (WPARAM) -1, (LONG) (LPSTR) buf) ;
  353.               lineError(lRet);
  354.       
  355.          }
  356.  
  357.           //lineGetDevCaps
  358.           //for each line device, get capabilities until we find one that supports
  359.          //interactive voice 
  360.           //...............................................
  361.          plineDevCaps = (LINEDEVCAPS *) calloc (1, sizeof(LINEDEVCAPS)+1000);
  362.          plineDevCaps->dwTotalSize = sizeof(LINEDEVCAPS) + 1000;
  363.          for (i = 0; i < myInfo.dwNumDevices; i++)
  364.          {
  365.             lineGetDevCaps(myInfo.lineApp, i, myInfo.dwAPIVersion, 0, plineDevCaps);
  366.             if (plineDevCaps->dwMediaModes & LINEMEDIAMODE_INTERACTIVEVOICE) 
  367.             {
  368.                
  369.                myLineInfo[i].dwNumAddress = plineDevCaps->dwNumAddresses;
  370.                   myLineInfo[i].dwLineID = i;
  371.                    if (plineDevCaps->dwLineNameSize > 0)
  372.                           strcpy(myLineInfo[i].szLineName,((LPSTR)(plineDevCaps)+plineDevCaps->dwLineNameOffset));
  373.              }
  374.           }
  375.          
  376.          break;
  377.       }
  378.       
  379.       case WM_SIZE:
  380.           MoveWindow(hListWnd,0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
  381.          break;
  382.  
  383.       case WM_DESTROY :
  384.               PostQuitMessage(0);
  385.               break;
  386.  
  387.       default :
  388.             return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
  389.    }
  390.  
  391.    return( 0L );
  392. }
  393.  
  394.  
  395.  
  396. /****************************************************************************
  397.     FUNCTION: lineCallback
  398.     PURPOSE:  callback function handles line events
  399. ****************************************************************************/
  400. LRESULT CALLBACK lineCallback (DWORD dwDevice, DWORD dwMsg,
  401.                                        DWORD dwCallbackInst, DWORD dwParam1,
  402.                                        DWORD dwParam2,DWORD dwParam3)
  403. {
  404.    switch (dwMsg)
  405.    {
  406.       case LINE_CALLSTATE:
  407.        {
  408.             for (i = 0; i < MAX_CALL; i++)
  409.            {
  410.                 if (dwDevice = (DWORD) myCallInfo[i].hCall) 
  411.                  switch (dwParam1)
  412.                  {
  413.                     case LINECALLSTATE_IDLE:
  414.                         myCallInfo[i].eCallState = Idle;
  415.                   break;
  416.                     
  417.                     case LINECALLSTATE_OFFERING:
  418.                         myCallInfo[i].eCallState = Offering;
  419.                          break;
  420.                     
  421.                     case LINECALLSTATE_ACCEPTED:
  422.                         myCallInfo[i].eCallState = Accepted;
  423.                         break;
  424.                     
  425.                     case LINECALLSTATE_DIALTONE:
  426.                         myCallInfo[i].eCallState = Dialtone;
  427.                   break;
  428.                     
  429.                     case LINECALLSTATE_DIALING:
  430.                         myCallInfo[i].eCallState = Dialing;
  431.                         break;
  432.                   
  433.                   case LINECALLSTATE_RINGBACK:
  434.                         myCallInfo[i].eCallState = Ringback;
  435.                         break;
  436.             
  437.                     case LINECALLSTATE_BUSY:
  438.                         myCallInfo[i].eCallState = Busy;
  439.                         break;
  440.             
  441.                     case LINECALLSTATE_SPECIALINFO:
  442.                         myCallInfo[i].eCallState = Special;
  443.                        break;
  444.             
  445.                     case LINECALLSTATE_CONNECTED:
  446.                        myCallInfo[i].eCallState = Connected;
  447.                   break;
  448.  
  449.                     case LINECALLSTATE_PROCEEDING:
  450.                         myCallInfo[i].eCallState = Proceeding;
  451.                        break;
  452.             
  453.                     case LINECALLSTATE_CONFERENCED:
  454.                         myCallInfo[i].eCallState = Conferenced;
  455.                        break;
  456.             
  457.                     case LINECALLSTATE_ONHOLDPENDCONF:
  458.                         break;
  459.                 
  460.                case LINECALLSTATE_DISCONNECTED:
  461.                         myCallInfo[i].eCallState = Disconnected;
  462.                        break;
  463.             
  464.                     case LINECALLSTATE_UNKNOWN:
  465.                         myCallInfo[i].eCallState = Unknown;
  466.                        break;
  467.        
  468.              }
  469.           }
  470.        }
  471.  
  472.        case LINE_MONITORMEDIA:
  473.            break;
  474.  
  475.        case LINE_MONITORDIGITS:
  476.           break;
  477.  
  478.          case LINE_MONITORTONE:
  479.           break;
  480.    
  481.        //error handling for functions completed asynchronously
  482.         //.....................................................
  483.        case LINE_REPLY:
  484.         {
  485.             for (i = 0; i < MAX_CALL; i++)
  486.            {
  487.                 if (dwParam1 = myCallInfo[i].dwRequestID)
  488.                {
  489.                    if (dwParam2 != 0)
  490.                    {
  491.                        lineError((LONG) dwParam2);
  492.                        break;
  493.                    }
  494.                }
  495.            }
  496.         break;
  497.         }
  498.  
  499.         case LINE_GENERATE:
  500.           break;
  501.      
  502.        case LINE_REQUEST:
  503.          break;
  504.  
  505.         case LINE_GATHERDIGITS:
  506.            break;
  507.    }
  508.  
  509.    return (TRUE);
  510.  
  511.  
  512. /****************************************************************************
  513.     FUNCTION: lineError
  514.     PURPOSE:  line error messages
  515. ****************************************************************************/
  516. void lineError (LONG lrc)
  517. {
  518.  switch (lrc) {
  519.     case LINEERR_INVALAPPHANDLE:
  520.        MessageBox (hWnd, "Invalid app handle.", "", MB_OK);
  521.        break;
  522.     case LINEERR_BADDEVICEID:
  523.        MessageBox (hWnd,"The specified line device ID is out of range.", "", 
  524.                    MB_OK);
  525.        break;
  526.     case LINEERR_INCOMPATIBLEAPIVERSION:
  527.        MessageBox (hWnd, "Incompatible API version.", "", MB_OK);
  528.        break;
  529.     
  530.     case LINEERR_ADDRESSBLOCKED:
  531.        MessageBox (hWnd, "Address was blocked.", "", MB_OK);
  532.        break;
  533.  
  534.     case LINEERR_BEARERMODEUNAVAIL:
  535.        MessageBox (hWnd, "Bearer Mode Unavailable.", "", MB_OK);
  536.        break;
  537.  
  538.     case LINEERR_CALLUNAVAIL:
  539.        MessageBox (hWnd, "Call appearances in use..", "", MB_OK);
  540.        break;
  541.  
  542.     case LINEERR_INUSE:
  543.        MessageBox (hWnd, "Line in Use.", "", MB_OK);
  544.        break;
  545.     
  546.     case LINEERR_INVALADDRESS:
  547.        MessageBox (hWnd, "Invalid Address.", "", MB_OK);
  548.        break;
  549.  
  550.     case LINEERR_INVALADDRESSID:
  551.        MessageBox (hWnd, "Invalid Address ID.", "", MB_OK);
  552.        break;
  553.  
  554.     case LINEERR_INVALCALLPARAMS:
  555.        MessageBox (hWnd, "Invalid Address ID.", "", MB_OK);
  556.        break;
  557.      
  558.     case LINEERR_INCOMPATIBLEEXTVERSION:
  559.        MessageBox (hWnd, "Incompatible extension version.","", MB_OK);
  560.        break;
  561.     case LINEERR_NOMEM:
  562.        MessageBox (hWnd, "No memory","", MB_OK);
  563.        break;
  564.     case LINEERR_NODRIVER:
  565.        MessageBox (hWnd, "No driver loaded", "", MB_OK);
  566.        break;
  567.     case LINEERR_RESOURCEUNAVAIL:
  568.        MessageBox (hWnd, "Resource overcommittment", "", MB_OK);
  569.        break;
  570.     case LINEERR_INVALPRIVSELECT:
  571.        MessageBox (hWnd, "Requested invalid priviledges", "", MB_OK);
  572.        break;
  573.     case LINEERR_INVALMEDIAMODE:
  574.        MessageBox (hWnd, "Requested invalid media mode", "", MB_OK);
  575.        break;
  576.     case LINEERR_LINEMAPPERFAILED:
  577.        MessageBox (hWnd, "Line mapper failed", "", MB_OK);
  578.        break;
  579.     case LINEERR_INVALPOINTER:
  580.        MessageBox (hWnd, "The specified pointer parameter is invalid.",
  581.                    "", MB_OK);
  582.        break;
  583.     case LINEERR_OPERATIONFAILED:
  584.        MessageBox (hWnd, "Operation failed.", "", MB_OK);
  585.        break;
  586.     case LINEERR_INVALLINEHANDLE:
  587.        MessageBox (hWnd, "Invalid line handle", "", MB_OK);
  588.        break;
  589.     case LINEERR_INVALCALLHANDLE:
  590.        MessageBox (hWnd, "Invalid call handle", "", MB_OK);
  591.        break;
  592.     case LINEERR_INVALCALLSELECT:
  593.        MessageBox (hWnd, "Invalid call selection", "", MB_OK);
  594.        break;
  595.     case LINEERR_NODEVICE:
  596.        MessageBox (hWnd, "No associated device for given class",
  597.                    "", MB_OK);
  598.        break;
  599.     case LINEERR_OPERATIONUNAVAIL:
  600.        MessageBox (hWnd, "The operation is unavailable",
  601.                    "", MB_OK);
  602.        break;
  603.     case LINEERR_INVALPARAM:
  604.         MessageBox(hWnd, "Invalid Paramater", "", MB_OK);
  605.        break; 
  606.  
  607.     case LINEERR_TARGETNOTFOUND:
  608.         MessageBox(hWnd, "Target Not Found", "", MB_OK);
  609.        break; 
  610.  
  611.    case LINEERR_NOREQUEST:
  612.       MessageBox(hWnd, "No outstanding Assisted Telephony requests.", "", MB_OK);
  613.        break; 
  614.    }
  615. }
  616.  
  617. LRESULT CALLBACK About( HWND hDlg,           
  618.                         UINT message,        
  619.                         WPARAM wParam,       
  620.                         LPARAM lParam)
  621. {
  622.    switch (message) 
  623.    {
  624.        case WM_INITDIALOG: 
  625.                return (TRUE);
  626.  
  627.        case WM_COMMAND:                              
  628.                if (   LOWORD(wParam) == IDOK         
  629.                    || LOWORD(wParam) == IDCANCEL)    
  630.                {
  631.                        EndDialog(hDlg, TRUE);        
  632.                        return (TRUE);
  633.                }
  634.                break;
  635.    }
  636.  
  637.    return (FALSE); 
  638. }
  639.  
  640.  
  641.  
  642.